package com.china08.yxyapi.api.manage.sch.platform.website.setting;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.china08.yxyapi.api.YxyApiBaseController;
import com.china08.yxyapi.model.YxyApiReqModel;
import com.china08.yxyapi.model.YxyApiRespModel;
import com.china08.yxyapi.repository.db.SwsSettingLinksRepository;

@CrossOrigin
@RestController("SwsSettingLinksDelController")
public class SwsSettingLinksDelController extends YxyApiBaseController {

    @Autowired
    private SwsSettingLinksRepository swsSettingLinksRepository;

    @RequestMapping(value = "/api_yw/manage/sch/platform/website/setting/links/delete", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Object precess(HttpServletRequest request, HttpServletResponse response,
            @RequestBody(required = false) ReqModel reqModel) {
        RespModel respModel = new RespModel();
        swsSettingLinksRepository.deleteById(reqModel.linkId);
        respModel.setMessage("删除成功");
        return respModel;
    }

    protected static class ReqModel extends YxyApiReqModel {

        public String linkId;

    }

    protected static class RespModel extends YxyApiRespModel {

    }
}
